﻿@*------------------------------------------------------------
  Copyright (c) Microsoft Corporation.  All rights reserved.
  Licensed under the MIT License (MIT). See License.txt in the repo root for license information.
 ------------------------------------------------------------*@

@using Microsoft.Azure.IIoT.App.Common
@using Microsoft.Azure.IIoT.App.Services.SecureData

@implements IDisposable

@inject Blazored.SessionStorage.ISessionStorageService sessionStorage
@inject UICommon CommonHelper
@inject SecureData secureData
@inject NavigationManager NavigationManager

<nav class="top-row pl-3 navbar navbar-dark ">
    @{ var releaseVersion = this.GetType().Assembly.GetSemanticVersion(); }
    <a class="navbar-brand" href="">
        Azure IIoT Platform @releaseVersion
    </a>
    <button class="navbar-toggler" @onclick="ToggleNavMenu">
        <span class="navbar-toggler-icon"></span>
    </button>
</nav>

<AuthorizeView>
    <Authorized>
        <div class="@NavMenuCssClass" @onclick="ToggleNavMenu">
            <ul class="nav flex-column">
                <li class="nav-item px-3">
                    <NavLink class="nav-link" href="discoverers">
                        <span class="oi oi-list-rich" aria-hidden="true"></span> Discovery
                    </NavLink>
                </li>
                <li class="nav-item px-3">
                    <NavLink class="nav-link" href="applications">
                        <span class="oi oi-list-rich" aria-hidden="true"></span> Assets
                    </NavLink>
                </li>
                <li class="nav-item px-3">
                    <NavLink class="nav-link" href="endpoints">
                        <span class="oi oi-list-rich" aria-hidden="true"></span> Browse
                    </NavLink>
                </li>
                <li class="nav-item px-3">
                    <NavLink class="nav-link" href="javascript: void(0)" @onclick="@(() => SubMenu())">
                        <span class="oi @SubMenuIcon" aria-hidden="true"></span> More
                    </NavLink>
                </li>
                <li class="nav-item px-5 @SubMenuDisplay">
                    <NavLink class="nav-link" href="supervisors">
                        <span class="oi oi-list-rich" aria-hidden="true"></span> Twin Module
                    </NavLink>
                </li>
                <li class="nav-item px-5 @SubMenuDisplay">
                    <NavLink class="nav-link" href="gateways">
                        <span class="oi oi-list" aria-hidden="true"></span> Gateway
                    </NavLink>
                </li>
                <li class="nav-item px-5 @SubMenuDisplay">
                    <NavLink class="nav-link " href="publishers">
                        <span class="oi oi-list" aria-hidden="true"></span> Publisher
                    </NavLink>
                </li>
                <li class="nav-item px-3">
                    <NavLink class="nav-link" href="assetLogin">
                        <span class="oi oi-account-login" aria-hidden="true"></span>
                        @if (Credential?.Username != null)
                        {
                            <span>Asset LogOut</span>
                            <div>Hello, @Credential.Username</div>
                        }
                        else
                        {
                            <span>Asset LogIn</span>
                        }
                    </NavLink>
                </li>
            </ul>
        </div>
    </Authorized>
</AuthorizeView>